package token

import (
	"github.com/golang-jwt/jwt/v5"
	"time"
)

const secret = "nL0wN3qZ2bR1mK2qL4oI"

func GenerateToken(userId uint32) (string, error) {
	claims := jwt.MapClaims{}
	claims["authorized"] = true
	claims["user_id"] = userId
	claims["exp"] = time.Now().Add(time.Hour * 24).Unix()
	token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)

	return token.SignedString([]byte(secret))
}
